//因为所有赋值操作都会触发 set()捕获器，所以可以根据所赋的值决定是允许还是拒绝赋值：
const target = {
  age:45
}
const proxy = new Proxy(target,{
  set(target,property,value,receiver){
    if(typeof value !== 'number'){
      return undefined
    } else {
      return Reflect.set(...arguments);
    }
  }
});
proxy.age = 12;
console.log(proxy.age);//12
proxy.age = '14';
console.log(proxy.age);//12